/**
 * Created by dukes on 2016/1/14.
 */
class BattleRecordPanel extends eui.Component{
    public constructor(){
        super();
        this.skinName = "skins.scene.BattleRecordSkin";
        this.addEventListener(egret.Event.ADDED_TO_STAGE,this.addedToStage, this );
    }
    private itemlist:eui.List;
    private addedToStage(evt:egret.Event){
        window["__battleRecord"]();
    }
    public updateDisplay(result){
        this.listProvider.source = result;
    }
    private listProvider:eui.ArrayCollection;
    public partAdded(name:string, instance:any) {
        super.partAdded(name, instance);
        if (name == "itemlist") {
            this.itemlist = instance;
            this.itemlist.itemRenderer = BattleRecordItem;//new eui.ClassFactory(
            this.listProvider = new eui.ArrayCollection();
            this.itemlist.dataProvider = this.listProvider;
        }
    }

    private static _instance:BattleRecordPanel;
    public static getInstance():BattleRecordPanel{
        if( BattleRecordPanel._instance == null )
            BattleRecordPanel._instance = new BattleRecordPanel();
        return BattleRecordPanel._instance;
    }
}